package com.matt.domain.rel;

import com.matt.foundation.model.UnionKey;
import lombok.Data;

import javax.persistence.*;

/**
 * 班级-保育员关系表
 * created by diao.qiao@outlook.com
 * from Matt
 * on 2018/12/25
 */

@Entity
@Data
@Table(name = "rel_classes_nurse")
public class RelClassesNurse {
    @EmbeddedId
    @AttributeOverrides({@AttributeOverride(name = "domainId",column = @Column(name ="staffId",nullable = false,length =32)),
            @AttributeOverride(name = "linkId",column = @Column(name="classesId",nullable = false,length = 32))})
    private UnionKey id;

    public static RelClassesNurse of(String nurseId, String classesId){
        RelClassesNurse relClassesNurse = new RelClassesNurse();
        relClassesNurse.setId(UnionKey.of(nurseId, classesId));
        return relClassesNurse;
    }
}
